home *** CD-ROM | disk | FTP | other *** search
- /************************************************************
-
- Rotate13.c
- Last Modified: Friday, May 31, 1991 at 9:46 PM
-
- Shift characters 13 positions
-
- © Copyright Evatac Software 1988-1990
- All rights reserved
-
- ************************************************************/
-
- #include "PCMD.h"
-
- main(
- unsigned char *sourceText,
- long sourceLength,
- unsigned char *destText,
- long *destSpace,
- PCMDInfo *info
- )
- {
- if (sourceLength > *destSpace)
- return(kPCMDMoreSpace);
-
- *destSpace = sourceLength;
-
- while (sourceLength-- > 0) {
- if (*sourceText >= 'A' && *sourceText <= 'Z')
- *destText = ((*sourceText - 'A' + 13) % 26) + 'A';
- else if (*sourceText >= 'a' && *sourceText <= 'z')
- *destText = ((*sourceText - 'a' + 13) % 26) + 'a';
- else
- *destText = *sourceText;
- sourceText++;
- destText++;
- }
- return(kPCMDSuccess);
- }
-